package com.xngpro.annotation.demo;

import android.support.annotation.IntDef;
import android.support.annotation.StringDef;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;

/**
 * Created by XngPro on 2017/2/8.
 */
public class Car {

    public static final int BENZ = 0x00;
    public static final int BMW = 0x01;
    public static final int AUDI = 0x02;

    @IntDef({BENZ, BMW, AUDI})
    @Retention(RetentionPolicy.SOURCE)
    public @interface Brand {
    }

    public static final String B = "Large family car";
    public static final String C = "Executive car";

    @StringDef({B, C})
    @Retention(RetentionPolicy.SOURCE)
    public @interface Classification {
    }

    private int mBrand;
    private String mClassification;

    @Brand
    public int getBrand() {
        return mBrand;
    }

    public void setBrand(@Brand int brand) {
        mBrand = brand;
    }

    @Classification
    public String getClassification() {
        return mClassification;
    }

    public void setClassification(@Classification String classification) {
        mClassification = classification;
    }
}
